unit KRK.Lib.RegExp.Utils;

{$WEAKPACKAGEUNIT ON}

interface

uses Classes;

function ApplyMask(aScript: TStrings; aText: String): String;

implementation

uses SysUtils, KRK.Lib.RegExp.PerlRegEx;

function ApplyMask(aScript: TStrings; aText: String): String;
begin
  Result := aText;

  if aScript.Count > 0 then
    with TPerlRegEx.Create(nil) do
      try
        Subject := UTF8String(aText);

        ScriptReplace(aScript);

        Result := String(Subject);
      finally
        Free;
      end;
end;

end.
